//当前这个模块：API进行统一管理 
import request from './request';

import mockRequest from './mockajax'



//三级联动接口
// /api/product/getBaseCategoryList  get 无参数

export  const reqCategoryList=()=>  request({url:'/product/getBaseCategoryList',method:'get'})


//获取banner(Home首页轮播图接口)
export const reqGetBannerList=()=> mockRequest({url:'/banner',method:'get'})

//获取floor数据
export const reqFloorList=()=>mockRequest({url:'/floor'})

//获取搜索块数据
//当前这个接口，给嗠器传递参数params,至少是一个空对象  
export const reqSearchInfo=(params)=>request({url:'/list',method:'post',data:params})

//获取产品详情信息的数据
export const reqGoodsInfo=(skuId)=>request({url:`/item/${skuId}`,method:'get'})

//将产品添加到购物车中(获取更新某一个产品的个数)
export const reqAddOrupdateShopCart=(skuId,skuNum)=>request({url:`/cart/addToCart/${skuId}/${skuNum}`,method:'post'})

//获取购物车的列表
export const reqGetShopCartInfo=()=>request({url:'/cart/cartList',method:'get'})

//删除购物产品的接口
export const reqDeteletCartById=(skuId)=>request({url:`cart/deleteCart/${skuId}`,method:'delete'})

//选中状态切换的接口
export const reqUpdateCheckById=(skuId,isChecked)=>request({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'})

//获取注册时的验证码
export const reqGetCode =(phone)=>request({url:`/user/passport/sendCode/${phone}`,method:'get'})

//注册用户的接口
export const reqUserRegister =(data)=>request({url:'/user/passport/register',method:'post',data:data})

//用户登录的接口
export const reqUserLogin=(data)=>request({url:'/user/passport/login',method:'post',data:data})

//用token获取用户信息
export const reqGetUserInfo=()=>request({url:'user/passport/auth/getUserInfo',method:'get'})

//退出登录
export const reqLogOut=()=>request({url:'/user/passport/logout',method:'get'})

//获取用户地址信息
export const reqAdressInfo=()=>request({url:'/user/userAddress/auth/findUserAddressList',method:'get'})

//获取订单交易页信息
export const reqOrderInfo=()=>request({url:'/order/auth/trade',method:'get'})

//提交订单的接口
 export const reqOrderSubmit=(tradeNo,data)=>request({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,method:'post',data}) 
//mock数据
/* export const reqOrderSubmit=()=>mockRequest({url:`/submitOrder`,method:'post'}) */

//获取订单支付信息
export const reqPayMent=(orderId)=>request({url:`/payment/weixin/createNative/${orderId}`,method:'get'})

//获取订单支付状态
export const reqPaySate=(orderId)=>request({url:`/payment/weixin/queryPayStatus/${orderId}`,method:'get'})

//获取个人中心订单列表
export const reqOrderList=(page,limit)=>request({url:`/order/auth/${page}/${limit}`,method:'get'})